<?php
namespace Home\Controller;

//use Think\Controller;
use Util\AccessController;

/*引用相应的配置*/
require_once(THINK_PATH . "Library/Util/WXJSSDK/JSSDK.php");
use Util\WXJSSDK\JSSDK;

class WxHtmlJsController extends AccessController {

    public function Index() {
        $url = $_POST['URL'];
        $JSSDK = new JSSDK(C('WX_APPID'), C('WX_SECRET'));
        $signPackage = $JSSDK->GetSignPackage($url);
        $this->ajaxReturn($signPackage, 'JSON');
    }
    //urldecode
    public function urldecode_Index() {
        $url = urldecode($_POST['URL']);
        $JSSDK = new JSSDK(C('WX_APPID'), C('WX_SECRET'));
        $signPackage = $JSSDK->GetSignPackage($url);
        $this->ajaxReturn($signPackage, 'JSON');
    }

    /*
    * 二维码
    */
    public function QRCode() {
        $JSSDK = new JSSDK(C('WX_APPID'), C('WX_SECRET'));
        $signPackage = $JSSDK->GetSignPackage();
        $this->Package = $signPackage;
        $this->display('Index');
    }


}